﻿using DataServer.Entities;
using IsPay.Logic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace IsPay.View
{
    public partial class ModifyEmail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["USERID"] == null || Session["USERID"].ToString().Length <= 0)
            {
                Response.Write("<script>top.location='../Default.aspx'</script>");
            }
            if (Request.Params["txtnewemail"] == null)
            {
                return;
            }
            String strnewemail = Request.Params["txtnewemail"].ToString().Trim();
            if (strnewemail.Length <= 0)
            {
                lblmsg.Text = "请输入新邮箱!";
                return;
            }
            UserProfile luser = (UserProfile)Session["LOGINUSER"];
            luser.Email = strnewemail;
            luser.LastLoginTimeKey = DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString();
            luser.LastPCIp = Request.UserHostAddress;
            luser.LastPCName = Request.UserHostName;
            luser.LastPCMac = "";
            List<UserProfile> lsuser = new List<UserProfile>();
            lsuser.Add(luser);
            UserSer us = new UserSer();
            String strrs=us.ModifyUsers(lsuser, luser.UserId);
            if (strrs.Equals("OK"))
            {
                lblmsg.Text = "更新成功";
            }
            else
            {
                lblmsg.Text = strrs;
            }
            Session["LOGINUSER"] = luser;
        }
    }
}